﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yu.Cms.Common;
using System.Data;

namespace Yu.Cms.Web.UserCtrl.Default
{
    public partial class Head : BaseCtrl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.OnStart();
            }

        }

        /// <summary>
        /// 启动
        /// </summary>
        protected void OnStart()
        {
            this.ShowBig();
            (base.Page.Master.FindControl("lblTitle") as Literal).Text = siteModel.SiteName;
        }

        /// <summary>
        /// 绑定大类
        /// </summary>
        protected void ShowBig()
        {
            rptb.DataSource = bllBigType.GetList();
            rptb.DataBind();
        }

        protected void rptb_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {

                Repeater rpts = e.Item.FindControl("rpts") as Repeater;//找到里层的repeater对象
                Yu.Cms.Model.BigType mBigType = (Yu.Cms.Model.BigType)e.Item.DataItem;//找到分类Repeater关联的数据项 
               if(mBigType!=null)
               {
                   int bigID = mBigType.BigTypeID; //获取填充子类的id 
                   rpts.DataSource = bllSmallType.GetList(bigID);
                   rpts.DataBind();
                }
            }
        }


       

        
       
    }
}